#region "DevelopmentLibraryDirectorySearchOrder"

/*
 * ####     Developer Name : Wang Yucai
 * 
 * ####     Development Tool : Microsoft VisualStudio 2010 Ultimate Edition
 * 
 * ####     Create Time : 2014-07-09 11:07:15
 * 
 * ####     Namespace : Masterduner.SourceStudio.Practices.DevelopmentLibrary.Environments
 * 
 * ####     Type Name : DevelopmentLibraryDirectorySearchOrder
 * 
 * ####     Full Name : Masterduner.SourceStudio.Practices.DevelopmentLibrary.Environments.DevelopmentLibraryDirectorySearchOrder
 * 
 * ####     Machine Name : GLCHQWYCWINW7
 * 
 * ####     UserName : GUOCOLAND/wangyucai
 * 
 * ####     CLR Version : 4.0.30319.18444
 * 
 * ####     Target Framework Version : 4.0
 */

#endregion

using System.Collections.Generic;
using System.Diagnostics;
using System.IO;

namespace Masterduner.SourceStudio.Practices.DevelopmentLibrary.Environments
{
    /// <summary>
    /// <para>Masterduner.SourceStudio.Practices.DevelopmentLibrary.Environments.DevelopmentLibraryDirectorySearchOrder</para>
    /// <para>
    /// 提供了访问开发库目录路径搜索顺序的方法。
    /// </para>
    /// </summary>
    /// <remarks>
    /// <para>Target Framework Version : 4.0</para>
    /// <para>此类不可继承。</para>
    /// </remarks>
    public sealed class DevelopmentLibraryDirectorySearchOrder
    {
        private int _index;
        private bool _exists;
        private DirectoryInfo _directoryInfo;
        static private List<DevelopmentLibraryDirectorySearchOrder> _orderCollections = new List<DevelopmentLibraryDirectorySearchOrder>();

        #region Index
        /// <summary>
        /// 获取加载顺序索引编号。
        /// </summary>
        public int Index
        {
            get { return _index; }
            private set { _index = value; }
        }
        #endregion

        #region Exists
        /// <summary>
        /// 获取当前顺序中搜索的目录路径是否存在。
        /// </summary>
        public bool Exists
        {
            get { return _exists; }
            private set { _exists = value; }
        }
        #endregion

        #region DirectoryInfo
        /// <summary>
        /// 获取当前搜索的目录路径信息。
        /// </summary>
        public DirectoryInfo DirectoryInfo
        {
            get { return _directoryInfo; }
            private set { _directoryInfo = value; }
        }
        #endregion

        #region Constructor

        /// <summary>
        /// <para>构造函数：</para>
        /// <para>初始化一个<see cref="DevelopmentLibraryDirectorySearchOrder" />对象实例。</para>
        /// </summary>
        private DevelopmentLibraryDirectorySearchOrder()
        {
        }

        #endregion

        #region AddOrder
        /// <summary>
        /// 添加一个搜索顺序。
        /// </summary>
        /// <param name="directory">搜索的目录路径信息。</param>
        static internal void AddOrder(DirectoryInfo directory)
        {
            Debug.WriteLine("DevelopmentLibraryDirectorySearchOrder::AddOrder::directory - [exist:{0}, index:{1}, path:{2}]", directory.Exists, _orderCollections.Count + 1, directory.FullName);
            _orderCollections.Add(new DevelopmentLibraryDirectorySearchOrder()
            {
                Index = _orderCollections.Count + 1,
                Exists = directory.Exists,
                DirectoryInfo = directory
            });
        }
        #endregion

        #region GetOrders
        /// <summary>
        /// 获取搜索顺序。
        /// </summary>
        /// <returns>搜索顺序。</returns>
        static internal IList<DevelopmentLibraryDirectorySearchOrder> GetOrders()
        {
            return _orderCollections;
        }
        #endregion
    }
}

#region README

/*
 * ####     ©2014 Wang Yucai
 * 
 * ####     Contact me
 *                  
 *                  E-mail : Masterduner@Yeah.net
 *                  Mobile : 13621384677
 *                  QQ : 180261899
 */

#endregion